SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

create procedure dbo.DnnProduct_GetSiteLog8

@PortalID int,
@PortalAlias nvarchar(50),
@StartDate datetime,
@EndDate datetime

as

select 'Month' = datepart(month,DateTime),
 'Views' = count(*),
 'Visitors' = count(distinct dbo.DnnProduct_SiteLog.UserHostAddress),
 'Users' = count(distinct dbo.DnnProduct_SiteLog.UserId)
from dbo.DnnProduct_SiteLog
where PortalId = @PortalID
and dbo.DnnProduct_SiteLog.DateTime between @StartDate and @EndDate
group by datepart(month,DateTime)
order by Month









GO
